package org.gap.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllRendezVouss", query = "select myRendezVous from RendezVous myRendezVous"),
		@NamedQuery(name = "findRendezVousByPrimaryKey", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvRendezVous = ?1"),
		@NamedQuery(name = "findRendezVousByRdvAdmission", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvAdmission = ?1"),
		@NamedQuery(name = "findRendezVousByRdvDate", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvDate = ?1"),
		@NamedQuery(name = "findRendezVousByRdvDateAfter", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvDate > ?1"),
		@NamedQuery(name = "findRendezVousByRdvDateBefore", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvDate < ?1"),
		@NamedQuery(name = "findRendezVousByRdvRendezVous", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvRendezVous = ?1"),
		@NamedQuery(name = "findRendezVousByRdvSpecialite", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvSpecialite = ?1"),
		@NamedQuery(name = "findRendezVousByRdvSpecialiteContaining", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvSpecialite like ?1"),
		@NamedQuery(name = "findRendezVousByRdvTiers", query = "select myRendezVous from RendezVous myRendezVous where myRendezVous.rdvTiers = ?1") })
@Table(schema = "GAP", name = "RENDEZ_VOUS")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "GAP_v2/org/gap/domain", name = "RendezVous")
public class RendezVous implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "RDV_RENDEZ_VOUS", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer rdvRendezVous;
	/**
	 */

	@Column(name = "RDV_TIERS", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Integer rdvTiers;
	/**
	 */

	@Column(name = "RDV_SPECIALITE", length = 15, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String rdvSpecialite;
	/**
	 */
	@Temporal(TemporalType.DATE)
	@Column(name = "RDV_DATE")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar rdvDate;
	/**
	 */

	@Column(name = "RDV_ADMISSION")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Integer rdvAdmission;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "RDV_PATIENT", referencedColumnName = "PAT_PATIENT") })
	@XmlTransient
	Patient patient;

	/**
	 */
	public void setRdvRendezVous(Integer rdvRendezVous) {
		this.rdvRendezVous = rdvRendezVous;
	}

	/**
	 */
	public Integer getRdvRendezVous() {
		return this.rdvRendezVous;
	}

	/**
	 */
	public void setRdvTiers(Integer rdvTiers) {
		this.rdvTiers = rdvTiers;
	}

	/**
	 */
	public Integer getRdvTiers() {
		return this.rdvTiers;
	}

	/**
	 */
	public void setRdvSpecialite(String rdvSpecialite) {
		this.rdvSpecialite = rdvSpecialite;
	}

	/**
	 */
	public String getRdvSpecialite() {
		return this.rdvSpecialite;
	}

	/**
	 */
	public void setRdvDate(Calendar rdvDate) {
		this.rdvDate = rdvDate;
	}

	/**
	 */
	public Calendar getRdvDate() {
		return this.rdvDate;
	}

	/**
	 */
	public void setRdvAdmission(Integer rdvAdmission) {
		this.rdvAdmission = rdvAdmission;
	}

	/**
	 */
	public Integer getRdvAdmission() {
		return this.rdvAdmission;
	}

	/**
	 */
	public void setPatient(Patient patient) {
		this.patient = patient;
	}

	/**
	 */
	public Patient getPatient() {
		return patient;
	}

	/**
	 */
	public RendezVous() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(RendezVous that) {
		setRdvRendezVous(that.getRdvRendezVous());
		setRdvTiers(that.getRdvTiers());
		setRdvSpecialite(that.getRdvSpecialite());
		setRdvDate(that.getRdvDate());
		setRdvAdmission(that.getRdvAdmission());
		setPatient(that.getPatient());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("rdvRendezVous=[").append(rdvRendezVous).append("] ");
		buffer.append("rdvTiers=[").append(rdvTiers).append("] ");
		buffer.append("rdvSpecialite=[").append(rdvSpecialite).append("] ");
		buffer.append("rdvDate=[").append(rdvDate).append("] ");
		buffer.append("rdvAdmission=[").append(rdvAdmission).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((rdvRendezVous == null) ? 0 : rdvRendezVous.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof RendezVous))
			return false;
		RendezVous equalCheck = (RendezVous) obj;
		if ((rdvRendezVous == null && equalCheck.rdvRendezVous != null) || (rdvRendezVous != null && equalCheck.rdvRendezVous == null))
			return false;
		if (rdvRendezVous != null && !rdvRendezVous.equals(equalCheck.rdvRendezVous))
			return false;
		return true;
	}
}
